const getCarType = function(types) {

	var subject = 'ccc';
	switch (types) {
		case '危险品':
			return subject = 'Z_WEIXIANPING';
			break;
		case '客运':
			return subject = 'Z_KEYUN';
			break;
		case '货运':
			return subject = 'Z_HUOYUN';
			break;
		case '小车':
			return subject = 'C1C2C3';
			break;
		case '客车':
			return subject = 'A1A3B1';
			break;
		case '货车':
			return subject = 'A2B2';
			break;
		case '摩托车':
			return subject = 'DEF';
			break;
		default:
			return subject = 'C1C2C3';
			break;
	}

}

const kemuname = function(kemu) {
	var subject = '科目一';
	switch (kemu) {
		case 1:
			return subject = '科目一';
			break;
		case 2:
			return subject = '科目二';
			break;
		case 3:
			return subject = '科目三';
			break;
		case 4:
			return subject = '科目四';
			break;
		case 0:
			return subject = '资格证';
			break;

		default:
			return subject = '科目一';
			break;
	}
}

const langname = function(lang) {
	var langstr = '汉语';
	switch (lang) {
		case 'cn':
			return langstr = '汉语';
			break;
		case 'kz':
			return langstr = '哈萨克语';
			break;
		case 'uy':
			return langstr = '维吾尔语';
			break;
		default:
			return langstr = '汉语';
			break;
	}
}
// const getimgname = function(imgurl){
// 	//let tempPath = imgurl.substring(0 + 1);
// 	return imgurl.substring(0, imgurl.lastIndexOf("."));
// }
//对比数组，多余的列出来
const getArrEqual = function(arr1, arr2) {
	let newArr = [];
	for (let i = 0; i < arr2.length; i++) {
		for (let j = 0; j < arr1.length; j++) {
			if (arr1[j] === arr2[i]) {
				newArr.push(arr1[j]);
			}
		}
	}
	return newArr;
}
//比对两个数组  不重复的列出来
const getArrload = function(arr1, arr2) {
	var array = arr1;
	var array2 = arr2;
	var arr3 = [];
	for (key in array) { //用来遍历的数组使用两个数组长度比较长的，不然可能没有效果
		var stra = array[key];
		var count = 0;
		for (var j = 0; j < array2.length; j++) {
			var strb = array2[j];
			if (stra == strb) {
				count++;
			}
		}
		if (count === 0) {
			arr3.push(stra);
		}
	}
	return arr3;
}
const getArrloads = function(arr1, arr2) {
	console.log("array,array2",arr1,arr2)
	var array = arr1;
	var array2 = arr2;
	var arr3 = [];
	for (key in array2) { //用来遍历的数组使用两个数组长度比较长的，不然可能没有效果
		var stra = array2[key];
		var count = 0;
		for (var j = 0; j < array.length; j++) {
			var strb = array[j];
			if (stra == strb) {
				count++;
			}
		}
		if (count === 0) {
			arr3.push(stra);
		}
	}
	return arr3;
}


// const upuserinfo = function(){
// 	const value = uni.getStorageSync('user_infos');
// 	var obj = JSON.parse(
// 		'{"openid":"' +
// 			value.openid +
// 			'","unionid": "' +
// 			value.unionid +
// 			'","kaishiriqi":"' +
// 			res.kaishiriqi +
// 			'","jieshuriqi":"' +
// 			res.jieshuriqi +
// 			'","userstatus":"' +
// 			res.userstatus +
// 			'","jihuofangshi":"' +
// 			value.jihuofangshi +
// 			'","nick_name":"' +
// 			value.nick_name +
// 			'","pic_url":"' +
// 			value.pic_url +
// 			'","uid":"' +
// 			value.uid +
// 			'","dailijibie":"' +
// 			res.dailijibie +
// 			'"}'
// 	);
// 	uni.setStorage({
// 	    key: 'user_infos',
// 	    data: obj,
// 	    success: function () {
// 	        console.log('success');
// 			uni.reLaunch({
// 				url:"../index/start"
// 			})
// 	    }
// 	});
// }



module.exports = {
	getCarType,
	getArrEqual,
	getArrload,
	getArrloads,
	kemuname,
	langname
	// getimgname
}